<template>
    <div class="law f f-ac f-jc" >
        <!-- :style="{backgroundColor: id%2 == '0' ? '#193980' : '#fff'}" -->
        <div class="law-body">
            <Sub-title :label="title" :color=" id%2 == '0' ? '#fff' : '#000'" padding="60px 0 10px" />
            <div class="f f-col f-ac f-jc">
                <img src="../../../assets/mountain-white.png" width="261px" height="80px" />
                <div class="fy-title mb-30" :style="{color: id%2 == '0' ? '#fff' : '#000'}">{{title}}</div>
            </div>
            <div class="f f-w">
                <div class="content-item mb-20" v-for="(i, k) in dataList" :key="k" @click="handleDetail(i)">
                    <div class="title line-1">{{ i.title || "-" }}</div>
                    <div class="content line-1 mt-20">{{ i.msg || "-" }}</div>
                    <img src="../../../assets/arrow-right.png" class="icon" />
                </div>
            </div>
            <div class="f f-jc mt-40 mb-40">
                <My-btn label="查看更多" width="198" height="52" bgColor="line-white"
                    @click="handleMore" />
            </div>
        </div>
    </div>
</template>

<script>
    import {
        heritageList
    } from "@/utils/heritage/index.js";
    export default {
        props: {
            // 表单名称
            id: {
                type: Number,
                default: 1,
            },
            title: {
                type: String,
                default: '',
            },
        },
        data() {
            return {
                baseUrl: process.env.VUE_APP_BASE_API,
                dataList: [],
            };
        },
        created() {
            this.getList();
        },
        methods: {
            // 获取传承人列表
            getList() {
                let that = this
                let data = {
                    heritage_category_id: this.id,
                    title: '',
                    type: '',
                    page: 1,
                    limit: 8,
                    recommend: 2
                }
                heritageList(data).then((response) => {
                    that.dataList = response.data.list
                    console.log(that.dataList, 'that.dataList')
                });
            },
            // 查看详情
            handleDetail(v) {
                this.$router.push({
                    path: "/cultural/lawDetails",
                    query: {
                        id: v.id,
                    },
                });
            },
            // 查看更多
            handleMore() {
                this.$router.push({
                    path: "/cultural/culturalList",
                    query: {
                        // type: "law",
                        type: this.id,
                    },
                });
            },
        },
    };
</script>

<style lang="scss" scoped>
    .law {
        width: 100%;
        max-height: 980px;
        background-color: #460202;
        background-image: url("../../../assets/inherit_bg.png");
        background-size: 100% 100%;
        background-repeat: no-repeat;

        &-body {
            width: 1200px;
            height: 100%;

            .fy-title {
                margin-top: 15px;
                color: #fff;
                font-family: FZZhengHeiS-B-GB;
                font-size: 20px;
            }

            .content-item {
                width: 590px;
                height: 122px;
                position: relative;
                background-color: #fff;
                border-radius: 20px;
                padding: 30px;
                box-sizing: border-box;
                transition: all 0.5s;
                box-shadow: 0 0 15px 0 rgba(255, 255, 255, 0.51);
                position: relative;

                &:nth-child(2n-1) {
                    margin-right: 20px;
                }

                &:hover {
                    cursor: pointer;
                    box-shadow: 0 0 15px 0 rgba(134, 134, 134, 0.7);
                }

                .title {
                    color: #313131;
                    font-size: 16px;
                    font-weight: 600;
                }

                .content {
                    color: #909090;
                    font-size: 14px;
                }

                >.icon {
                    width: 11px;
                    height: 17px;
                    position: absolute;
                    right: 20px;
                    bottom: 33px;
                }
            }
        }
    }
</style>